package edu.ucsc.gameAI.conditions;

import edu.ucsc.gameAI.ICondition;
import pacman.game.Constants.GHOST;
import pacman.game.Game;

public class GhostInRegion implements ICondition{

	int y2;
	int y1;
	int x2;
	int x1;

	public GhostInRegion(int x1, int y1, int x2, int y2) {
		this.x1 = x1;
		this.x2 = x2;
		this.y1 = y1;
		this.y2 = y2;
	}

	public boolean test(Game game) {
		for(GHOST ghost : GHOST.values())
		{
			int x = game.getNodeXCood(game.getGhostCurrentNodeIndex(ghost));
			int y = game.getNodeYCood(game.getGhostCurrentNodeIndex(ghost));
			
			if ( (x1 < x) && (x2 > x) && (y1 < y) && (y2 > y) ) 
				return true;

		}
		return false;
	}

}
